﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.RenderStateBlock
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>A set of values that Unity uses to override the GPU's render state.</para>
  /// </summary>
  /// <summary>
  ///   <para>Creates a new render state block with the specified mask.</para>
  /// </summary>
  /// <param name="mask">Specifies which parts of the GPU's render state to override.</param>
  public struct RenderStateBlock(RenderStateMask mask) : IEquatable<RenderStateBlock>
  {
    private BlendState m_BlendState = BlendState.defaultValue;
    private RasterState m_RasterState = RasterState.defaultValue;
    private DepthState m_DepthState = DepthState.defaultValue;
    private StencilState m_StencilState = StencilState.defaultValue;
    private int m_StencilReference = 0;
    private RenderStateMask m_Mask = mask;

    /// <summary>
    ///   <para>Specifies the new blend state.</para>
    /// </summary>
    public BlendState blendState
    {
      get => this.m_BlendState;
      set => this.m_BlendState = value;
    }

    /// <summary>
    ///   <para>Specifies the new raster state.</para>
    /// </summary>
    public RasterState rasterState
    {
      get => this.m_RasterState;
      set => this.m_RasterState = value;
    }

    /// <summary>
    ///   <para>Specifies the new depth state.</para>
    /// </summary>
    public DepthState depthState
    {
      get => this.m_DepthState;
      set => this.m_DepthState = value;
    }

    /// <summary>
    ///   <para>Specifies the new stencil state.</para>
    /// </summary>
    public StencilState stencilState
    {
      get => this.m_StencilState;
      set => this.m_StencilState = value;
    }

    /// <summary>
    ///   <para>The value to be compared against and/or the value to be written to the buffer, based on the stencil state.</para>
    /// </summary>
    public int stencilReference
    {
      get => this.m_StencilReference;
      set => this.m_StencilReference = value;
    }

    /// <summary>
    ///   <para>Specifies which parts of the GPU's render state to override.</para>
    /// </summary>
    public RenderStateMask mask
    {
      get => this.m_Mask;
      set => this.m_Mask = value;
    }

    public bool Equals(RenderStateBlock other)
    {
      return this.m_BlendState.Equals(other.m_BlendState) && this.m_RasterState.Equals(other.m_RasterState) && this.m_DepthState.Equals(other.m_DepthState) && this.m_StencilState.Equals(other.m_StencilState) && this.m_StencilReference == other.m_StencilReference && this.m_Mask == other.m_Mask;
    }

    public override bool Equals(object obj)
    {
      return obj != null && obj is RenderStateBlock other && this.Equals(other);
    }

    public override int GetHashCode()
    {
      return (int) ((RenderStateMask) (((((this.m_BlendState.GetHashCode() * 397 ^ this.m_RasterState.GetHashCode()) * 397 ^ this.m_DepthState.GetHashCode()) * 397 ^ this.m_StencilState.GetHashCode()) * 397 ^ this.m_StencilReference) * 397) ^ this.m_Mask);
    }

    public static bool operator ==(RenderStateBlock left, RenderStateBlock right)
    {
      return left.Equals(right);
    }

    public static bool operator !=(RenderStateBlock left, RenderStateBlock right)
    {
      return !left.Equals(right);
    }
  }
}
